import axios from './request';
import qs from 'qs'

// 热门兑换接口
export const remenApi = () => axios.get("/products/hot");

// 推荐接口
export const tuijianApi = () => axios.get("/products/recommend");

// 手机号验证
export const sendSMSApi = (param) => axios.post("/sendSMS", qs.stringify(param));

// 登陆接口
export const phoneReginApi = (param) => axios.post("/phoneRegin", qs.stringify(param));

// 微信扫码登陆接口
export const wechatApi = (param) => axios.post("/wechatUsers/PCLogin", qs.stringify(param));

// 手机号绑定微信
export const bandingApi = (param) => axios.post("/wechatUsers/binding", qs.stringify(param));

// 获取用户信息
export const getuserApi = () => axios.get("/shop/userProfiles");
// export const getuserApi = () => axios.get("/shop/userProfiles",
//   { headers: { "x-auth-token": localStorage.getItem('token') } });

// 商品详情
export const detailApi = (id) => axios.get(`/products/${id}`);

// 商品搜索（含首页的“更多”）
export const goodsApi = (params) => axios.get(`/products`, { params });//params:params

// 加入到购物车
export const addcartApi = (param) => axios.post(`/shop/carts/add`, qs.stringify(param));

// 查看购物车
export const cartsApi = () => axios.get(`/shop/carts`);

// 删除购物车
export const delcartApi = (param) => axios.delete(`/shop/carts?productIds=${param}`);

// console.log(qs.stringify({ a: 1, b: 12 }));
